/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.test
 */
package org.sysdance.aplicativo.visao.operacoes;

import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;

import org.syndance.aplicativo.enums.PesquisarPorSatusSala;
import org.sysdance.aplicativo.util.visao.JanelaDialogo;

import org.sysdance.aplicativo.visao.tela.TelaSala;


public class OpSala extends JanelaDialogo {

    TelaSala telaSala;

    /**
     * Creates new form NewJDialog
     */
    public OpSala(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        for (PesquisarPorSatusSala pesquisarPorStatusSala : PesquisarPorSatusSala.values()) {
            cbPesquisarPorSala.addItem(pesquisarPorStatusSala.name());
        }

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelSala = new javax.swing.JPanel();
        jblPesquisarSala = new javax.swing.JLabel();
        cbPesquisarPorSala = new javax.swing.JComboBox();
        tfCampoBuscaSala = new javax.swing.JTextField();
        btnConsultarSala = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblListarSala = new javax.swing.JTable();
        btnIncluirSala = new javax.swing.JButton();
        btnAlterarSala = new javax.swing.JButton();
        btnStatusSala = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanelSala.setBorder(javax.swing.BorderFactory.createTitledBorder("Salas:"));
        jPanelSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jblPesquisarSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jblPesquisarSala.setText("Status da Sala:");

        btnConsultarSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        btnConsultarSala.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/consultar.png"))); // NOI18N
        btnConsultarSala.setText("Consultar");

        tblListarSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        tblListarSala.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Id:", "Descrição:"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tblListarSala);

        btnIncluirSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        btnIncluirSala.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/adicionar.png"))); // NOI18N
        btnIncluirSala.setText("Incluir");
        btnIncluirSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIncluirSalaActionPerformed(evt);
            }
        });

        btnAlterarSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        btnAlterarSala.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/alterar.png"))); // NOI18N
        btnAlterarSala.setText("Alterar");
        btnAlterarSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAlterarSalaActionPerformed(evt);
            }
        });

        btnStatusSala.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        btnStatusSala.setText("Ativar / Desativar");
        btnStatusSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnStatusSalaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelSalaLayout = new javax.swing.GroupLayout(jPanelSala);
        jPanelSala.setLayout(jPanelSalaLayout);
        jPanelSalaLayout.setHorizontalGroup(
            jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSalaLayout.createSequentialGroup()
                .addGroup(jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelSalaLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jblPesquisarSala)
                            .addComponent(cbPesquisarPorSala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(tfCampoBuscaSala, javax.swing.GroupLayout.PREFERRED_SIZE, 388, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnConsultarSala))
                    .addGroup(jPanelSalaLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnStatusSala)
                        .addGap(26, 26, 26)
                        .addComponent(btnAlterarSala)
                        .addGap(26, 26, 26)
                        .addComponent(btnIncluirSala)))
                .addContainerGap())
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 706, Short.MAX_VALUE)
        );
        jPanelSalaLayout.setVerticalGroup(
            jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSalaLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jblPesquisarSala)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tfCampoBuscaSala, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cbPesquisarPorSala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnConsultarSala)))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 344, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanelSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAlterarSala, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnIncluirSala, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnStatusSala, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanelSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanelSala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        getAccessibleContext().setAccessibleName("Cadastro de Curso\n");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnIncluirSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIncluirSalaActionPerformed
        // TODO add your handling code here:

        if ((telaSala == null) || (!telaSala.isVisible())) {
            telaSala = new TelaSala(null, true);
            telaSala.setLocationRelativeTo(this);
            telaSala.setVisible(true);
        }
    }//GEN-LAST:event_btnIncluirSalaActionPerformed

    private void btnAlterarSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarSalaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnAlterarSalaActionPerformed

    private void btnStatusSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStatusSalaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnStatusSalaActionPerformed

    private void cbCompararPorItemStateChanged(java.awt.event.ItemEvent evt) {

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(OpSala.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(OpSala.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(OpSala.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(OpSala.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                OpSala dialog = new OpSala(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAlterarSala;
    private javax.swing.JButton btnConsultarSala;
    private javax.swing.JButton btnIncluirSala;
    private javax.swing.JButton btnStatusSala;
    private javax.swing.JComboBox cbPesquisarPorSala;
    private javax.swing.JPanel jPanelSala;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel jblPesquisarSala;
    private javax.swing.JTable tblListarSala;
    private javax.swing.JTextField tfCampoBuscaSala;
    // End of variables declaration//GEN-END:variables

}
